#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void staticArray();
void stackArray();
void heapArray();

int main(void){
    clock_t start, end;
    int i;
    start = clock();
    for(i = 0; i < 100000; i++){
        staticArray();
    }
    end = clock();
    printf("Static array : %lfs\n",((double)(end-start))/((double)CLOCKS_PER_SEC));
    start = clock();
    for(i = 0; i < 100000; i++){
        stackArray();
    }
    end = clock();
    printf("Stack array : %lfs\n",((double)(end-start))/((double)CLOCKS_PER_SEC));
    start = clock();
    for(i = 0; i < 100000; i++){
        heapArray();
    }
    end = clock();
    printf("Heap array : %lfs\n",((double)(end-start))/((double)CLOCKS_PER_SEC));
    return 0;
}

void staticArray() {
    static int a1[100000000];
    return;
}
void stackArray() {
    int a2[100000000];
    return;
}
void heapArray() {
    int * a3 = (int*)malloc(sizeof(int)*100000000);
    free(a3);
}
